# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: team/gnome <pabloyoyoista@postmarketos.org>
pkgname=gdm
pkgver=47.0
pkgrel=1
pkgdesc="GNOME display manager"
url="https://wiki.gnome.org/Projects/GDM"
# blocked by gnome-shell
arch="all !armhf !s390x"
license="GPL-2.0-or-later"
depends="
	dbus
	dconf
	gnome-session
	gnome-settings-daemon
	gnome-shell
	gsettings-desktop-schemas
	linux-pam>=1.4
	xrdb
	xwayland
	"
makedepends="
	accountsservice-dev
	elogind-dev
	eudev-dev
	gettext
	glib-dev
	gtk+3.0-dev
	itstool
	json-glib-dev
	libcanberra-dev
	libgudev-dev
	libsm-dev
	libx11-dev
	libxau-dev
	libxcb-dev
	libxdmcp-dev
	linux-pam-dev
	meson
	"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang $pkgname-openrc"
options="!check" # Causes circular dep with gnome-shell
source="
	https://download.gnome.org/sources/gdm/${pkgver%%.*}/gdm-$pkgver.tar.xz
	0001-DOWNSTREAM-use-bin-touch-instead-of-usr-bin-touch.patch
	0003-DOWNSTREAM-pam-rename-common-to-base.patch
	gdm.initd
	Xsession
	"
install="gdm.pre-install gdm.post-deinstall"

build() {
	abuild-meson \
		-Db_lto=true \
		-Ddbus-sys=/usr/share/dbus-1/system.d \
		-Ddefault-pam-config=openembedded \
		-Dlibaudit=disabled \
		-Dlogind-provider=elogind \
		-Dselinux=disabled \
		-Dsystemd-journal=false \
		-Dsystemdsystemunitdir=no \
		-Dsystemduserunitdir=no \
		-Dxdmcp=disabled \
		. output
	meson compile -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output

	install -m755 -D "$srcdir/Xsession" "$pkgdir"/etc/gdm
	install -m755 -D "$srcdir/$pkgname.initd" "$pkgdir"/etc/init.d/gdm
}

sha512sums="
5578b2839ec78ef0b155a6ef6b82384495ef0f3ceb49f4bc7c656bf9dafa95b260148c7fc9b8295b71d4a2d33f6fe6c4a47485cd9eba5c0929f0492ba06e0893  gdm-47.0.tar.xz
c5c57ee93f5a33db154632f0f81fa2e62a48635cfa5e51ada9cc969478df0ce15878446c639c8647c53d439f2eb4173e7fca0069eae31fbdcec541cc5f28cd28  0001-DOWNSTREAM-use-bin-touch-instead-of-usr-bin-touch.patch
66611d49fc4c9578415a7e554834edcb9de99396bd0ca511dcfd4fb256e8a1cd1fd5f10464f4668ffe04799d919bc22ddb58e8bf272017edba69a7951522e63d  0003-DOWNSTREAM-pam-rename-common-to-base.patch
cd4c8f80e37dc362727bd535cbe1d3917f2bc47d52af717595e19709051ab5f27c0f650195152ccd1a7e5e2f886e4e8bc60287f05dcd81e84237c7f78c89223f  gdm.initd
f836cf0acdf148f2ae09ac28251b5126ce597f08254c43b1ec77596f75e1a3229926116c13f98554625be763e8d28415b27bd679b0a5de9f86bdca7857054c82  Xsession
"
